package com.weitu.worklicense.service.impl;

import com.weitu.worklicense.entity.SafetyMeasures;
import com.weitu.worklicense.entity.SafetyMeasuresCriteria;
import com.weitu.worklicense.mapper.SafetyMeasuresMapper;
import com.weitu.worklicense.service.SafetyMeasuresService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class SafetyMeasuresServiceImpl implements SafetyMeasuresService {
    private final SafetyMeasuresMapper safetyMeasuresMapper;

    private static final Logger logger = LoggerFactory.getLogger(SafetyMeasuresServiceImpl.class);

    @Autowired
    public SafetyMeasuresServiceImpl(SafetyMeasuresMapper safetyMeasuresMapper) {
        this.safetyMeasuresMapper = safetyMeasuresMapper;
    }

    @Override
    public int countByCriteria(SafetyMeasuresCriteria example) {
        int count = this.safetyMeasuresMapper.countByCriteria(example);
        logger.debug("count: {}", count);
        return count;
    }

    @Override
    public SafetyMeasures selectByPrimaryKey(String id) {
        return this.safetyMeasuresMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<SafetyMeasures> selectByCriteria(SafetyMeasuresCriteria example) {
        return this.safetyMeasuresMapper.selectByCriteria(example);
    }

    @Override
    @Transactional
    public int deleteByPrimaryKey(String id) {
        return this.safetyMeasuresMapper.deleteByPrimaryKey(id);
    }

    @Override
    @Transactional
    public int updateByPrimaryKeySelective(SafetyMeasures record) {
        return this.safetyMeasuresMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    @Transactional
    public int updateByCriteriaSelective(SafetyMeasures record, SafetyMeasuresCriteria example) {
        return this.safetyMeasuresMapper.updateByCriteriaSelective(record, example);
    }

    @Override
    @Transactional
    public int insertSelective(SafetyMeasures record) {
        return this.safetyMeasuresMapper.insertSelective(record);
    }
}